/**
 */
package org.mro.grib.model.files.secondEdition.sections.impl;

import org.eclipse.emf.common.notify.Notification;

import org.eclipse.emf.ecore.EClass;

import org.eclipse.emf.ecore.impl.ENotificationImpl;
import org.eclipse.emf.ecore.impl.EObjectImpl;

import org.mro.grib.model.files.secondEdition.sections.IndicatorSection;
import org.mro.grib.model.files.secondEdition.sections.SectionsPackage;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>Indicator Section</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 *   <li>{@link org.mro.grib.model.files.secondEdition.sections.impl.IndicatorSectionImpl#getStartOffset <em>Start Offset</em>}</li>
 *   <li>{@link org.mro.grib.model.files.secondEdition.sections.impl.IndicatorSectionImpl#getEndOffset <em>End Offset</em>}</li>
 *   <li>{@link org.mro.grib.model.files.secondEdition.sections.impl.IndicatorSectionImpl#getDiscipline <em>Discipline</em>}</li>
 *   <li>{@link org.mro.grib.model.files.secondEdition.sections.impl.IndicatorSectionImpl#getGribEditionNumber <em>Grib Edition Number</em>}</li>
 *   <li>{@link org.mro.grib.model.files.secondEdition.sections.impl.IndicatorSectionImpl#getMessageLength <em>Message Length</em>}</li>
 * </ul>
 * </p>
 *
 * @generated
 */
public class IndicatorSectionImpl extends EObjectImpl implements IndicatorSection {
	/**
	 * The default value of the '{@link #getStartOffset() <em>Start Offset</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getStartOffset()
	 * @generated
	 * @ordered
	 */
	protected static final long START_OFFSET_EDEFAULT = 0L;

	/**
	 * The cached value of the '{@link #getStartOffset() <em>Start Offset</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getStartOffset()
	 * @generated
	 * @ordered
	 */
	protected long startOffset = START_OFFSET_EDEFAULT;

	/**
	 * The default value of the '{@link #getEndOffset() <em>End Offset</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getEndOffset()
	 * @generated
	 * @ordered
	 */
	protected static final long END_OFFSET_EDEFAULT = 0L;

	/**
	 * The cached value of the '{@link #getEndOffset() <em>End Offset</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getEndOffset()
	 * @generated
	 * @ordered
	 */
	protected long endOffset = END_OFFSET_EDEFAULT;

	/**
	 * The default value of the '{@link #getDiscipline() <em>Discipline</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getDiscipline()
	 * @generated
	 * @ordered
	 */
	protected static final byte DISCIPLINE_EDEFAULT = 0x00;

	/**
	 * The cached value of the '{@link #getDiscipline() <em>Discipline</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getDiscipline()
	 * @generated
	 * @ordered
	 */
	protected byte discipline = DISCIPLINE_EDEFAULT;

	/**
	 * The default value of the '{@link #getGribEditionNumber() <em>Grib Edition Number</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getGribEditionNumber()
	 * @generated
	 * @ordered
	 */
	protected static final byte GRIB_EDITION_NUMBER_EDEFAULT = 0x00;

	/**
	 * The cached value of the '{@link #getGribEditionNumber() <em>Grib Edition Number</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getGribEditionNumber()
	 * @generated
	 * @ordered
	 */
	protected byte gribEditionNumber = GRIB_EDITION_NUMBER_EDEFAULT;

	/**
	 * The default value of the '{@link #getMessageLength() <em>Message Length</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getMessageLength()
	 * @generated
	 * @ordered
	 */
	protected static final long MESSAGE_LENGTH_EDEFAULT = 0L;

	/**
	 * The cached value of the '{@link #getMessageLength() <em>Message Length</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getMessageLength()
	 * @generated
	 * @ordered
	 */
	protected long messageLength = MESSAGE_LENGTH_EDEFAULT;

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected IndicatorSectionImpl() {
		super();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	protected EClass eStaticClass() {
		return SectionsPackage.Literals.INDICATOR_SECTION;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public long getStartOffset() {
		return startOffset;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setStartOffset(long newStartOffset) {
		long oldStartOffset = startOffset;
		startOffset = newStartOffset;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, SectionsPackage.INDICATOR_SECTION__START_OFFSET, oldStartOffset, startOffset));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public long getEndOffset() {
		return endOffset;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setEndOffset(long newEndOffset) {
		long oldEndOffset = endOffset;
		endOffset = newEndOffset;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, SectionsPackage.INDICATOR_SECTION__END_OFFSET, oldEndOffset, endOffset));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public byte getDiscipline() {
		return discipline;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setDiscipline(byte newDiscipline) {
		byte oldDiscipline = discipline;
		discipline = newDiscipline;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, SectionsPackage.INDICATOR_SECTION__DISCIPLINE, oldDiscipline, discipline));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public byte getGribEditionNumber() {
		return gribEditionNumber;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setGribEditionNumber(byte newGribEditionNumber) {
		byte oldGribEditionNumber = gribEditionNumber;
		gribEditionNumber = newGribEditionNumber;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, SectionsPackage.INDICATOR_SECTION__GRIB_EDITION_NUMBER, oldGribEditionNumber, gribEditionNumber));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public long getMessageLength() {
		return messageLength;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setMessageLength(long newMessageLength) {
		long oldMessageLength = messageLength;
		messageLength = newMessageLength;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, SectionsPackage.INDICATOR_SECTION__MESSAGE_LENGTH, oldMessageLength, messageLength));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Object eGet(int featureID, boolean resolve, boolean coreType) {
		switch (featureID) {
			case SectionsPackage.INDICATOR_SECTION__START_OFFSET:
				return getStartOffset();
			case SectionsPackage.INDICATOR_SECTION__END_OFFSET:
				return getEndOffset();
			case SectionsPackage.INDICATOR_SECTION__DISCIPLINE:
				return getDiscipline();
			case SectionsPackage.INDICATOR_SECTION__GRIB_EDITION_NUMBER:
				return getGribEditionNumber();
			case SectionsPackage.INDICATOR_SECTION__MESSAGE_LENGTH:
				return getMessageLength();
		}
		return super.eGet(featureID, resolve, coreType);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public void eSet(int featureID, Object newValue) {
		switch (featureID) {
			case SectionsPackage.INDICATOR_SECTION__START_OFFSET:
				setStartOffset((Long)newValue);
				return;
			case SectionsPackage.INDICATOR_SECTION__END_OFFSET:
				setEndOffset((Long)newValue);
				return;
			case SectionsPackage.INDICATOR_SECTION__DISCIPLINE:
				setDiscipline((Byte)newValue);
				return;
			case SectionsPackage.INDICATOR_SECTION__GRIB_EDITION_NUMBER:
				setGribEditionNumber((Byte)newValue);
				return;
			case SectionsPackage.INDICATOR_SECTION__MESSAGE_LENGTH:
				setMessageLength((Long)newValue);
				return;
		}
		super.eSet(featureID, newValue);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public void eUnset(int featureID) {
		switch (featureID) {
			case SectionsPackage.INDICATOR_SECTION__START_OFFSET:
				setStartOffset(START_OFFSET_EDEFAULT);
				return;
			case SectionsPackage.INDICATOR_SECTION__END_OFFSET:
				setEndOffset(END_OFFSET_EDEFAULT);
				return;
			case SectionsPackage.INDICATOR_SECTION__DISCIPLINE:
				setDiscipline(DISCIPLINE_EDEFAULT);
				return;
			case SectionsPackage.INDICATOR_SECTION__GRIB_EDITION_NUMBER:
				setGribEditionNumber(GRIB_EDITION_NUMBER_EDEFAULT);
				return;
			case SectionsPackage.INDICATOR_SECTION__MESSAGE_LENGTH:
				setMessageLength(MESSAGE_LENGTH_EDEFAULT);
				return;
		}
		super.eUnset(featureID);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public boolean eIsSet(int featureID) {
		switch (featureID) {
			case SectionsPackage.INDICATOR_SECTION__START_OFFSET:
				return startOffset != START_OFFSET_EDEFAULT;
			case SectionsPackage.INDICATOR_SECTION__END_OFFSET:
				return endOffset != END_OFFSET_EDEFAULT;
			case SectionsPackage.INDICATOR_SECTION__DISCIPLINE:
				return discipline != DISCIPLINE_EDEFAULT;
			case SectionsPackage.INDICATOR_SECTION__GRIB_EDITION_NUMBER:
				return gribEditionNumber != GRIB_EDITION_NUMBER_EDEFAULT;
			case SectionsPackage.INDICATOR_SECTION__MESSAGE_LENGTH:
				return messageLength != MESSAGE_LENGTH_EDEFAULT;
		}
		return super.eIsSet(featureID);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public String toString() {
		if (eIsProxy()) return super.toString();

		StringBuffer result = new StringBuffer(super.toString());
		result.append(" (startOffset: "); //$NON-NLS-1$
		result.append(startOffset);
		result.append(", endOffset: "); //$NON-NLS-1$
		result.append(endOffset);
		result.append(", discipline: "); //$NON-NLS-1$
		result.append(discipline);
		result.append(", gribEditionNumber: "); //$NON-NLS-1$
		result.append(gribEditionNumber);
		result.append(", messageLength: "); //$NON-NLS-1$
		result.append(messageLength);
		result.append(')');
		return result.toString();
	}

} //IndicatorSectionImpl
